package geographer;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Project #3
 * CS 2334, 010
 * 03/26/2014
 * <P>
 * This class represents a place of interest. Implements Serializable.
 * </P>
 * @version 2.0
 */
public class Place extends GeographicRegion implements Serializable
{
	/**
	 * The unique serial id for this place.
	 */
	private static final long serialVersionUID = 1L;

	/*The String description of the particular POI*/
	String description;
	
	/*The list of which countries this POI belongs to*/
	List<String> belongingTo;
	
	/**
	 * This is the constructor for a <code>Place</code> object.
	 * @param data         The data for a <code>Place</code> object
	 */
	public Place(String... data) {
		super(data[0], null, data[1]);
		description = data[2];
		belongingTo = new ArrayList<String>(data.length-3);
		
		for(int i = 3; i < data.length; ++i)
			belongingTo.add(data[i]);
	}
	
	public void edit(String[] data)
	{
		super.edit(data[0], null, data[1]);
		description = data[1];
		belongingTo = new ArrayList<String>(data.length-3);
		
		for(int i = 3; i < data.length; ++i)
			belongingTo.add(data[i]);
	}
	
	/**
	 * Accesses the <code>description</code> field of the Place object.
	 * @return description     The description of the Place object.
	 */
	public String getDescription()
	{
		return this.description;
	}//end getDescription
	
	/**
	 * Accesses the <code>belongingCountries</code> field of the Place object.
	 * @return belongingCountries   The list of countries of the Place object.
	 */
	public List<String> getOwners()
	{
		return belongingTo;
	}//end getOwners
	
	@Override
	public String toString() {
		String place = 	this.getName()+", "+
						this.getArea()+", "+
						this.getDescription();
		
		for(String country: belongingTo)
			place += ", "+country;
				
		return place;
	}
}//end Place
